package utils;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * ClassName:DateTimeUtil
 * Package:utils
 * Description
 *
 * @Author:@wenxueshi
 * @Create:2023/7/22 - 17:07
 * @Version:v1.0
 */
//日期时间类封装
public class DateTimeUtil {
    //格式：2023-07-22
    private static final String DATE_FORMAT = "yyyy-MM-dd";

    //格式：2023-07-22 16:50:28
    private static final String DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss";

    //格式：2023-07-22 16:50:28
    private static final String DATE_TIME_DEF_FORMAT = "yyyy年MM月dd日 HH时mm分钟ss秒";

    public static String date(){
        return new SimpleDateFormat(DATE_FORMAT).format(new Date());
    }

    public static String dateTime(){
        return new SimpleDateFormat(DATE_TIME_FORMAT).format(new Date());
    }

    public static String dateDefTime(){
        return new SimpleDateFormat(DATE_TIME_DEF_FORMAT).format(new Date());
    }

    public static void main(String[] args) {
        //2023-07-22
        System.out.println(DateTimeUtil.date());
        //2023-07-22 17:16:43
        System.out.println(DateTimeUtil.dateTime());
        //2023年07月22日 17时16分钟43秒
        System.out.println(DateTimeUtil.dateDefTime());
    }
}
